-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Adds initial support for recomposing commits from a branch #4713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Note: we have a bug with storing merge bases for branches at the moment (we are choosing the upstream rather than the upstream's merge base) which causes the composer to find no diff when you make a local branch from a remote one. I will address this separately and rebase this on top of it once it is addressed. |
8561a88 to
7c9fab4
Compare
099b6f0 to
07bf736
Compare
It was not a bug. It looked for the upstream only when the local wasn't available. But that logic wasn't working well in several cases (it would return zero commit responses), so I just used recursive merge target look-up until we find one with commits. |
| export function parseCoAuthorsFromGitCommit(commit: GitCommit): GitCommitIdentityShape[] { | ||
| const coAuthors: GitCommitIdentityShape[] = []; | ||
| if (!commit.message) return coAuthors; | ||
|
|
||
| const coAuthorRegex = /^Co-authored-by:\s*(.+?)(?:\s*<(.+?)>)?\s*$/gm; | ||
| let match; | ||
| while ((match = coAuthorRegex.exec(commit.message)) !== null) { | ||
| const [, name, email] = match; | ||
| if (name) { | ||
| coAuthors.push({ name: name.trim(), email: email?.trim(), date: commit.date }); | ||
| } | ||
| } | ||
|
|
||
| return coAuthors; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be great to add in other commit authorship/avatar content throughout GitLens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will make a note to pull it into a shared util file later. Thanks!
d13
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
07bf736 to
12b86ff
Compare
Closes #4598
Closes #4599
New command is
Recompose Commits (Preview)and is accessible from branches in views and graph, and from Command Palette.